package com.web.base.user.message;

import java.io.Serializable;
import java.util.Date;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Size;

import com.blue.core.dict.Auth;
import com.blue.validation.FieldNotBlank;
import com.blue.validation.Mobile;
import com.blue.validation.Password;
import com.blue.validation.PasswordType;
import com.blue.validation.group.GetModel;
import com.blue.validation.group.SaveModel;
import com.blue.validation.group.UpdateModel;
import com.web.base.valid.UserLogin;
import com.web.base.valid.UserPassword;
import com.web.base.valid.UserReg;
import com.web.base.valid.WechatLogin;
import com.web.core.dict.UserRole;

/**
 * 用户请求内容
 * 
 * @author 代码由 blue-code 框架生成
 * @since 1.0 2017年04月16日
 */
@FieldNotBlank(fields = { "name", "mobile", "email" }, groups = { UserLogin.class }, message = "用户名，手机号码，电子邮箱不能同时为空")
public class UserRequest implements Serializable
{
	private static final long serialVersionUID = 1L;

	@NotNull(groups = { UpdateModel.class, GetModel.class }, message = "编号不能为空")
	@Null(groups = { UserReg.class, SaveModel.class }, message = "编号必须为空")
	private Integer id;
	@NotBlank(groups = { UserReg.class, SaveModel.class, UpdateModel.class }, message = "用户名不能为空")
	@Size(min = 0, max = 20, groups = { UserReg.class, SaveModel.class, UpdateModel.class }, message = "用户名长度[0-20]")
	private String name;
	@NotBlank(groups = {UserReg.class, SaveModel.class, UserLogin.class, UserPassword.class}, message = "密码不能为空")
	@Size(min = 0, max = 50, groups = {UserReg.class, SaveModel.class, UpdateModel.class, UserLogin.class}, message = "密码长度[0-50]")
	@Password(type = PasswordType.SHA1, groups = {UserReg.class, SaveModel.class, UpdateModel.class, UserLogin.class}, message = "密码格式错误")
	private String password;
	@Size(min = 0, max = 20, groups = { UserReg.class, SaveModel.class, UpdateModel.class }, message = "手机长度[0-20]")
	@NotBlank(groups = { UserReg.class, SaveModel.class }, message = "手机不能为空")
	@Mobile(groups = { UserReg.class, SaveModel.class, UpdateModel.class }, message = "手机格式错误")
	private String mobile;
	@Size(min = 0, max = 50, groups = { SaveModel.class, UpdateModel.class }, message = "微信UnionId长度[0-50]")
	private String wxUnionId;
	@NotBlank(groups = { UserReg.class, SaveModel.class }, message = "用户昵称不能为空")
	@Size(min = 0, max = 50, groups = { UserReg.class, SaveModel.class, UpdateModel.class }, message = "用户昵称长度[0-50]")
	private String nickname;
	@Size(min = 0, max = 200, groups = { UserReg.class, SaveModel.class, UpdateModel.class }, message = "用户头像长度[0-200]")
	private String pic;
	@Size(min = 0, max = 200, groups = { UserReg.class, SaveModel.class, UpdateModel.class }, message = "邮箱长度[0-200]")
	@Email(groups = { UserReg.class, SaveModel.class, UpdateModel.class }, message = "邮箱格式错误")
	private String email;
	private Date createTime;
	private Date loginTime;
	private UserRole role;
	private Auth auth;

	@NotBlank(groups = {UserReg.class}, message = "手机验证码不能为空")
	private String num;
	@NotNull(groups = {UserReg.class, UserLogin.class}, message = "应用ID不能为空")
	private Integer appId;
	@NotBlank(groups = { UserReg.class, UserLogin.class }, message = "IP地址不能为空")
	private String ip;
	@NotBlank(groups = { UserPassword.class }, message = "旧密码不能为空")
	private String oldPassword;

	@NotBlank(groups = {WechatLogin.class}, message = "微信openId不能为空")
	private String wxOpenId;
	@NotNull(groups = {WechatLogin.class}, message = "微信ID不能为空")
	private Integer wechatId;

	public UserRequest()
	{
	}

	public Integer getId()
	{
		return this.id;
	}

	public void setId(Integer id)
	{
		this.id = id;
	}

	public String getName()
	{
		return this.name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getPassword()
	{
		return this.password;
	}

	public void setPassword(String password)
	{
		this.password = password;
	}

	public String getMobile()
	{
		return this.mobile;
	}

	public void setMobile(String mobile)
	{
		this.mobile = mobile;
	}

	public String getWxUnionId()
	{
		return this.wxUnionId;
	}

	public void setWxUnionId(String wxUnionId)
	{
		this.wxUnionId = wxUnionId;
	}

	public String getNickname()
	{
		return this.nickname;
	}

	public void setNickname(String nickname)
	{
		this.nickname = nickname;
	}

	public String getPic()
	{
		return this.pic;
	}

	public void setPic(String pic)
	{
		this.pic = pic;
	}

	public String getEmail()
	{
		return this.email;
	}

	public void setEmail(String email)
	{
		this.email = email;
	}

	public Date getCreateTime()
	{
		return this.createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public Date getLoginTime()
	{
		return this.loginTime;
	}

	public void setLoginTime(Date loginTime)
	{
		this.loginTime = loginTime;
	}

	public UserRole getRole()
	{
		return role;
	}

	public void setRole(UserRole role)
	{
		this.role = role;
	}

	public Auth getAuth()
	{
		return auth;
	}

	public void setAuth(Auth auth)
	{
		this.auth = auth;
	}

	public Integer getAppId()
	{
		return appId;
	}

	public void setAppId(Integer appId)
	{
		this.appId = appId;
	}

	public String getIp()
	{
		return ip;
	}

	public void setIp(String ip)
	{
		this.ip = ip;
	}

	public String getOldPassword()
	{
		return oldPassword;
	}

	public void setOldPassword(String oldPassword)
	{
		this.oldPassword = oldPassword;
	}

	public String getWxOpenId()
	{
		return wxOpenId;
	}

	public void setWxOpenId(String wxOpenId)
	{
		this.wxOpenId = wxOpenId;
	}

	public Integer getWechatId()
	{
		return wechatId;
	}

	public void setWechatId(Integer wechatId)
	{
		this.wechatId = wechatId;
	}

	public String getNum()
	{
		return num;
	}

	public void setNum(String num)
	{
		this.num = num;
	}
}
